﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Win32;
using System.Collections.ObjectModel;
using System.IO;

namespace sync.UI
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        private ObservableCollection<Repository> loadedRepositories = new ObservableCollection<Repository>();

        public ObservableCollection<Repository> LoadedRepositories
        {
            get
            {
                return this.loadedRepositories;
            }
        }

        public Window1()
        {
            InitializeComponent();
        }

        private void OpenRepository_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            var dialogResult = dlg.ShowDialog();
            if (dialogResult == true)
            {
                FileInfo configFileInfo = new FileInfo(dlg.FileName);
                Repository repository = new Repository(configFileInfo);
                loadedRepositories.Add(repository);
                repository.BringOnline();
            }
        }

        private void CreateRepository_Click(object sender, RoutedEventArgs e)
        {

        }
    }
}
